home *** CD-ROM | disk | FTP | other *** search
- Path: rcp6.elan.af.mil!rscernix!danpop
- From: danpop@mail.cern.ch (Dan Pop)
- Newsgroups: comp.lang.c
- Subject: Re: (void(far *)()) 0
- Date: 8 Feb 96 19:18:45 GMT
- Organization: CERN European Lab for Particle Physics
- Message-ID: <danpop.823807125@rscernix>
- References: <341998718.10858110@magnet.at> <31165B9D.398E@imsisoft.com> <4f66c0$cn0@solutions.solon.com> <3118F813.41BF@imsisoft.com>
- NNTP-Posting-Host: hpl3sn02.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
-
- In <3118F813.41BF@imsisoft.com> Victor Bazarov <vbazarov@imsisoft.com> writes:
-
- >As I undestood, this "may produce different results":
- >
- >typedef void (far *pVOIDVOID)();
- >int zero = 0;
- >pVOIDVOID funky;
- >funky = (void(far *)()) zero;
- >
- >than
- >
- >typedef void (far *pVOIDVOID)();
- >pVOIDVOID funky;
- >funky = (void(far *)()) 0;
-
- Both of them may produce _any_ results, because of the presence of "far",
- which invokes undefined behaviour (and requires a diagnostic).
-
- If we remove it (there is absolutely no need for it in this discussion),
- the first example produces an implementation-defined result, while the
- second produces a well defined result.
-
- BTW, I'd rather write:
-
- funky = 0; /* Not really, funky = NULL; is my favourite */
-
- but if you insist on the cast, make it (pVOIDVOID) 0.
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-